#pragma once
#include "HashTable.h"
namespace unset {

	template<class K,class Hash=HashFunc<K>>
	class unorder_set
	{
		struct KeyOfSet {
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename  bucketHash::HashBucket<K, K, Hash, KeyOfSet>::iterator iterator;
		pair<iterator,bool> insert(const K& key)
		{
			return _ht.insert(key);
		}
		iterator begin()
		{
			return _ht.begin();
		}
		iterator end()
		{
			return _ht.end();
		}
	private:
		bucketHash::HashBucket<K, K, Hash, KeyOfSet> _ht;

	};


	void TestIterator()
	{
		unorder_set<int> us;
		us.insert(2);
		us.insert(23);
		us.insert(24);
		us.insert(22);
		us.insert(25);
		us.insert(27);
		us.insert(29);
		us.insert(299);
		unorder_set<int>::iterator it = us.begin();
		while (it != us.end())
		{
			cout << *it << "  ";
			++it;
		}
		cout << endl;
		for (auto it : us)
		{
			cout << it << endl;
		}
	}
}